package com.demo.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.demo.util.ShardingAlgorithmUtil;

@Component
@Slf4j
public class ShardingInitRunner implements InitializingBean {

    @Value("${spring.datasource.url}")
    private String url;

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("sharding初始化...");
        ShardingAlgorithmUtil.init(url);
    }

}
